using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;

namespace TMM
{
    public static class UIHelper
    {
        public static void SetIcon(Context context, ImageButton button, string iconName)
        {
            if (string.IsNullOrEmpty(iconName))
                return;

            var iconId = context.Resources.GetIdentifier(iconName, "drawable", context.PackageName);
            if (iconId > 0)
            {
                var iconDrawable = context.Resources.GetDrawable(iconId);
                button.SetImageDrawable(iconDrawable);
                button.Visibility = ViewStates.Visible;
            }
            else button.Visibility = ViewStates.Gone;
        }
    }
}